| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 6 | |||
| 7 | export class IsUserAlreadyAddedToSchool { |
||
| 8 | constructor( |
||
| 9 | @Inject('ISchoolUserRepository') |
||
| 10 | private readonly schoolUserRepository: ISchoolUserRepository |
||
| 11 | ) {} |
||
| 12 | |||
| 13 | public async isSatisfiedBy(school: School, user: User): Promise<boolean> { |
||
| 14 | if (user.getRole() === UserRole.PHOTOGRAPHER) { |
||
| 15 | return true; |
||
| 16 | } |
||
| 17 | |||
| 18 | return ( |
||
| 19 | (await this.schoolUserRepository.findOneByUserAndSchool(user, school)) instanceof SchoolUser |
||
| 20 | ); |
||
| 23 |